package org.todo.dao;

import java.util.List;
import org.todo.domain.Todo;

/**
 * Interface of a DAO object to store and retrieve todo items in the DB
 * @author Matthias Braunhofer
 */
public interface TodoDao {

    /**
     * Fetches all todo items that belong to a certain category
     * @param categoryId
     * @return
     */
    public List<Todo> findTodosForCategory(int categoryId);

    /**
     * Fetches all todo items for a certain user
     * @param username
     * @return
     */
    public List<Todo> findTodosForUser(String username);

    /**
     * Fetches a todo item from the DB passing its id
     * @param todoId
     * @return
     */
    public Todo getTodo(int todoId);

    /**
     * Saves a todo item into the DB
     * @param todo
     */
    public void saveTodo(Todo todo);

    /**
     * Deletes a todo item from the DB
     * @param todo
     */
    public void deleteTodo(Todo todo);

    /**
     * Returns all todo items for a certain user (including publicly available ones)
     * from the DB that match the specified search criteria
     * @param username
     * @param searchText
     * @return
     */
    public List<Todo> searchTodos(String username, String searchText);
}
